using System.Diagnostics;
using Hjson;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RSCore;

namespace TestProject;

[TestClass]
public class UnitTest1
{
	[TestMethod]
	public void TestMethod1()
	{
		var input = Path.Combine(Environment.CurrentDirectory, "..", "..", "..", "Input");
		var output = Path.Combine(Environment.CurrentDirectory, "..", "..", "..", "Output");
		KeyConverter.Instance = new KeyConverter144();
		var dir = TextIO.LoadHjson(Path.Combine(input, "en-US-144.hjson"), "ExampleMod");

		//var dir = TmlHelper.ReadLocalizationFile("Test", TmlHelper.ToDictionary(json));
		var options = new HjsonOptions()
		{
			EmitRootBraces = false,
			KeepWsc = true,
		};
		TextIO.SaveHjson(Path.Combine(output, "144.hjson"), dir, "ExampleMod");
		HjsonValue.Save(dir.Serialize(), Path.Combine(output, "rs.hjson"), options);
		//HjsonValue.Save(dir.Serialize(), Path.Combine(output, "rs.hjson"), options);
		//KeyConverter.Instance = new KeyConverter143();
		//HjsonValue.Save(TmlHelper.WriteLocalizationFile(dir, "Test"), Path.Combine(output, "143.hjson"), options);
		//KeyConverter.Instance = new KeyConverter144();
		//HjsonValue.Save(TmlHelper.WriteLocalizationFile(dir, "Test"), Path.Combine(output, "144.hjson"), options);
	}

	[TestMethod]
	public void TestMatch()
	{
		var str = "测试案例名称 - Test";
		Assert.IsTrue(str.SmartMatch("cs-t"));
		Assert.IsFalse(str.SmartMatch("ws"));
		Assert.IsTrue(str.SmartMatch("tes"));
		Assert.IsFalse(str.SmartMatch("tse"));
	}
}